/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "SelectedSalt")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SelectedSalt.findAll", query = "SELECT s FROM SelectedSalt s"),
    @NamedQuery(name = "SelectedSalt.findBySelectedSaltID", query = "SELECT s FROM SelectedSalt s WHERE s.selectedSaltID = :selectedSaltID"),
    @NamedQuery(name = "SelectedSalt.findBySelectedSaltNotes", query = "SELECT s FROM SelectedSalt s WHERE s.selectedSaltNotes = :selectedSaltNotes"),
    @NamedQuery(name = "SelectedSalt.findBySelectedSaltGrams", query = "SELECT s FROM SelectedSalt s WHERE s.selectedSaltGrams = :selectedSaltGrams")})
public class SelectedSalt implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "selectedSaltID")
    private Integer selectedSaltID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 100)
    @Column(name = "selectedSaltNotes")
    private String selectedSaltNotes;
    @Basic(optional = false)
    @NotNull
    @Column(name = "selectedSaltGrams")
    private float selectedSaltGrams;
    @JoinColumn(name = "saltIdx", referencedColumnName = "saltID", nullable=true)
    @ManyToOne(optional = true)
    private WaterSalts waterSaltID;

    public SelectedSalt() {
    }

    public SelectedSalt(Integer selectedSaltID) {
        this.selectedSaltID = selectedSaltID;
    }

    public SelectedSalt(Integer selectedSaltID, String selectedSaltNotes, float selectedSaltGrams) {
        this.selectedSaltID = selectedSaltID;
        this.selectedSaltNotes = selectedSaltNotes;
        this.selectedSaltGrams = selectedSaltGrams;
    }

    public Integer getSelectedSaltID() {
        return selectedSaltID;
    }

    public void setSelectedSaltID(Integer selectedSaltID) {
        this.selectedSaltID = selectedSaltID;
    }

    public String getSelectedSaltNotes() {
        return selectedSaltNotes;
    }

    public void setSelectedSaltNotes(String selectedSaltNotes) {
        this.selectedSaltNotes = selectedSaltNotes;
    }

    public float getSelectedSaltGrams() {
        return selectedSaltGrams;
    }

    public void setSelectedSaltGrams(float selectedSaltGrams) {
        this.selectedSaltGrams = selectedSaltGrams;
    }

    public WaterSalts getWaterSaltID() {
        return waterSaltID;
    }

    public void setWaterSaltID(WaterSalts waterSaltID) {
        this.waterSaltID = waterSaltID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (selectedSaltID != null ? selectedSaltID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SelectedSalt)) {
            return false;
        }
        SelectedSalt other = (SelectedSalt) object;
        if ((this.selectedSaltID == null && other.selectedSaltID != null) || (this.selectedSaltID != null && !this.selectedSaltID.equals(other.selectedSaltID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.SelectedSalt[ selectedSaltID=" + selectedSaltID + " ]";
    }
    
}
